
#include "stdafx.h"

#define VLDBUILD     // Declares that we are building Visual Leak Detector.
#include "vldint.h"  // Provides access to the Visual Leak Detector internals.
#include "vldheap.h" // Provides internal new and delete operators.
#include "vldapi.h"

// Imported global variables.
extern VisualLeakDetector g_vld;

////////////////////////////////////////////////////////////////////////////////
//
//  Visual Leak Detector APIs - see vldapi.h for each function's details.
//

//extern "C" {

void VLDAPI VLDDisable ()
{
    g_vld.DisableLeakDetection();
}

void VLDAPI VLDEnable ()
{
    g_vld.EnableLeakDetection();
}

void VLDAPI VLDRestore ()
{
    g_vld.RestoreLeakDetectionState();
}

void VLDAPI VLDGlobalDisable ()
{
    g_vld.GlobalDisableLeakDetection();
}

void VLDAPI VLDGlobalEnable ()
{
    g_vld.GlobalEnableLeakDetection();
}

UINT VLDAPI VLDReportLeaks ()
{
    return (UINT)g_vld.ReportLeaks();
}

UINT VLDAPI VLDGetLeaksCount ()
{
    return (UINT)g_vld.GetLeaksCount();
}

void VLDAPI VLDMarkAllLeaksAsReported()
{
    g_vld.MarkAllLeaksAsReported();
}

void VLDAPI VLDRefreshModules()
{
    g_vld.RefreshModules();
}

void VLDAPI VLDEnableModule(HMODULE module)
{
    g_vld.EnableModule(module);
}

void VLDAPI VLDDisableModule(HMODULE module)
{
    g_vld.DisableModule(module);
}

UINT VLDAPI VLDGetOptions()
{
    return g_vld.GetOptions();
}

void VLDAPI VLDGetReportFilename(WCHAR *filename)
{
    g_vld.GetReportFilename(filename);
}

void VLDAPI VLDSetOptions(UINT option_mask, SIZE_T maxDataDump, UINT maxTraceFrames)
{
    g_vld.SetOptions(option_mask, maxDataDump, maxTraceFrames);
}

int VLDAPI VLDSetReportHook(int mode,  VLD_REPORT_HOOK pfnNewHook)
{
    return g_vld.SetReportHook(mode, pfnNewHook);
}

void VLDAPI VLDSetModulesList(CONST WCHAR *modules, BOOL includeModules)
{
    g_vld.SetModulesList(modules, includeModules);
}

BOOL VLDAPI VLDGetModulesList(WCHAR *modules, UINT size)
{
    return g_vld.GetModulesList(modules, size);
}

void VLDAPI VLDSetReportOptions(UINT option_mask, CONST WCHAR *filename)
{
    g_vld.SetReportOptions(option_mask,filename);
}

void VLDAPI VLDResolveCallstacks()
{
    g_vld.ResolveCallstacks();
}

//}
